import BuffUtil from '@/BuffUtil';
import TalentBase from 'code/Scripts/Abilities/base/TalentBase';
const desc = `被你造成过伤害的敌人在${ColorSafe}5|r秒内降低护甲和魔抗${ColorSafe}10%|r。最多叠加3层。|n觉醒后降低效果增加到${ColorSafe}15%|r。`;
const art = 'assets\\icon\\Spell_Shadow_CurseOfSargeras.blp';
const name = '腐蚀术';
const config: TalentConfigModel = {
    id: 'talent_t_corrosion',
    name,
    desc,
    art,
    buffType: {
        id: 'buff_t_corrosion',
        art,
        name,
        ubertip: desc,
    },
    buffTypePlus: {
        id: 'buff_t_corrosion_plus',
        art,
        name: '腐蚀术[觉醒]',
        ubertip: `被你造成过伤害的敌人在${ColorSafe}5|r秒内降低护甲和魔抗${ColorSafe}15%|r。最多叠加3层`,
    },
};

const effectBuffType: AppBuffType = {
    id: 'buff_t_corrosion_effect',
    art,
    ubertip: '受到腐蚀术的影响，护甲与魔抗都降低了',
    dur: 5,
    stackCountMax: 3,
    attribute: {
        护甲百分比: -0.1,
        魔抗百分比: -0.1,
    },
    targetAttach: 'overhead',
    targetArt: 'Abilities\\Spells\\Undead\\Curse\\CurseTarget.mdl',
    isDebuff: true,
};
const effectBuffTypePlus: AppBuffType = {
    ...effectBuffType,
    id: 'buff_t_corrosion_plus_effect',
    attribute: {
        护甲百分比: -0.15,
        魔抗百分比: -0.15,
    },
};
export default class Talentcorrosion extends TalentBase {
    static instance: Talentcorrosion;
    constructor(p?: TalentConfigModel) {
        super(p);
        Talentcorrosion.instance = this;
        this.setTalentConfig(config);
        this.init();
        EventManager.onTakeDamage(this.damagedEffect);
    }
    damagedEffect(d: DamageEventData) {
        let { unEffect, plus } = Talentcorrosion.instance.talentUnEffect(d.source);
        if (unEffect) return;
        let id = plus ? effectBuffTypePlus.id : effectBuffType.id;
        BuffUtil.addBuff(d.target, id, d.source);
    }
    init() {
        BuffUtil.registerBuffType(effectBuffType);
        BuffUtil.registerBuffType(effectBuffTypePlus);
    }
}
